Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cohort filtering in ParticipantsDeclarationsQuery #4794

Merged
merged 5 commits into from
Jun 5, 2024

Conversation

ethax-ross
Copy link
Collaborator

@ethax-ross ethax-ross commented May 15, 2024

Context

Jira-3059

Previously, we would filter using the induction records -> cohort for ECF and profile -> schedule -> cohort for NPQ participants. Now that we have a cohort directly on the ParticipantDeclaration, we can simplify the filtering logic.

Changes proposed in this pull request

  • Update cohort filtering in ParticipantsDeclarationsQuery

Guidance to review

I compared filtering against the snapshot DB using main and this branch and added a diff of where the API endpoint would return differently for a few providers/cohorts. The vast majority that differ are either voided, clawedback or awaiting_clawback and for the most part the stamped cohort matches the first statement -> cohort but the participant profile -> schedule -> cohort or latest induction record -> cohort causes it to return differently in the current declarations API.

Copy link

Review app deployed to https://cpd-ecf-review-4794-web.test.teacherservices.cloud

return ParticipantDeclaration.none if npq_lead_provider.blank?

with_joins(scope).where(participant_profile: { type: "ParticipantProfile::NPQ", schedule: { cohorts: { start_year: cohort_years } } })
scope = with_joins(ParticipantDeclaration.for_lead_provider(cpd_lead_provider))
Copy link
Collaborator

@cwrw cwrw May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im wondering if we need the with_joins if there is no cohort filter? also worth revisiting those joins as we might no longer need some of them since cohort is on declaration now

@ethax-ross ethax-ross force-pushed the 3056-filter-declarations-by-cohort branch from c6807d0 to fa7cec3 Compare May 17, 2024 08:37
@ethax-ross ethax-ross requested a review from ltello May 17, 2024 10:38
@ethax-ross ethax-ross force-pushed the 3056-filter-declarations-by-cohort branch from fa7cec3 to 397ed9d Compare May 20, 2024 09:37
@ethax-ross ethax-ross force-pushed the 3056-filter-declarations-by-cohort branch from 34f6aec to 30e3704 Compare May 20, 2024 10:16
@ethax-ross ethax-ross force-pushed the 3056-filter-declarations-by-cohort branch from 30e3704 to ab6ad4e Compare May 20, 2024 10:52
@ethax-ross ethax-ross marked this pull request as ready for review May 20, 2024 11:22
Copy link
Collaborator

@cwrw cwrw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@ethax-ross ethax-ross added the blocked-merge Do not merge this PR label May 28, 2024
@ethax-ross ethax-ross force-pushed the 3056-filter-declarations-by-cohort branch 2 times, most recently from 7d6950b to 9331367 Compare May 30, 2024 13:50
@ethax-ross ethax-ross added this pull request to the merge queue May 30, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 30, 2024
@ethax-ross ethax-ross removed the blocked-merge Do not merge this PR label Jun 4, 2024
@ethax-ross ethax-ross force-pushed the 3056-filter-declarations-by-cohort branch from 63e1bb6 to 1366044 Compare June 5, 2024 08:37
Previously, we would filter using the induction records -> cohort for ECF and
profile -> schedule -> cohort for NPQ participants. Now that we have a `cohort`
directly on the `ParticipantDeclaration`, we can simplify the filtering logic.
As we filter by declaration -> cohort we no longer need to join on other cohorts.

Move join on induction records to previous declarations scope as its only used there.
I wanted to do this in the factory originally, but it creates a cyclic
dependency on the `participant_profile -> cohort` so we need to define it
explicitly for now.
@ethax-ross ethax-ross force-pushed the 3056-filter-declarations-by-cohort branch from 1366044 to c57640f Compare June 5, 2024 11:58
@ethax-ross ethax-ross added this pull request to the merge queue Jun 5, 2024
Merged via the queue into main with commit cf2bbb7 Jun 5, 2024
31 checks passed
@ethax-ross ethax-ross deleted the 3056-filter-declarations-by-cohort branch June 5, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants